﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Default.aspx.vb" Inherits="LFC_photosharing._Default1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Welcome to KOP's Photosharing
        </h2>
<!--change the name of tag prefix to make sure there is no conflict when the other functions are using-->
<ajx:ToolkitScriptManager 
            ID="ToolkitScriptManager1" runat="server">
        </ajx:ToolkitScriptManager>
   <div style="position: relative; top: 474px; left: 6px;border:2px solid #969696;">
       <h3>Tag</h3>
       <p>
       <asp:DataList ID="DataList1" runat="server" DataKeyField="ID" 
               DataSourceID="SqlDataSource1" RepeatDirection="Horizontal">
           <ItemTemplate>
           <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("TagName","Photolist.aspx?Tag={0}") %>' style="text-decoration:none "> 
                   &nbsp;&nbsp; &nbsp;&nbsp;
                   <asp:Label ID="TagLabel" runat="server" Text='<%# Eval("TagName") %>' />
                   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </asp:HyperLink><br /><br /></ItemTemplate></asp:DataList><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
               ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
               ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
               SelectCommand="SELECT [ID], [TagName] FROM [Tag]">
               </asp:SqlDataSource>
        </p>
   </div>
   
   <div 
        
        
        
        style="position: relative; top: -76px; left: 33px; width:251px;border:2px solid #969696;"><h3>The Most Viewed Picture</h3><p><asp:DataList 
            ID="DataList2" runat="server" DataKeyField="ID" DataSourceID="SqlDataSource2"><ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID","PhotoDetails.aspx?ID={0}") %>'>
                        <asp:Image src='<%# Eval("Picture") %>' Height = '250px' Width = '250px' ID="Image1" runat="server"/>  
                    </asp:HyperLink></ItemTemplate></asp:DataList><asp:SqlDataSource 
            ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>"  
            SelectCommand="SELECT TOP 1 [PhotofkidCount], [PhotoName], [Picture], [ID] FROM [PhotoViewCount]"></asp:SqlDataSource></p>
        
        </div>
   
   <div        
        
        
        
        
        
        
        
        
        style="position: relative; top: -397px; left: 333px; width:251px;border:2px solid #969696;"><h3>The Most Rated Picture</h3><p><asp:DataList 
            ID="DataList3" runat="server" DataSourceID="SqlDataSource3"><ItemTemplate><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID","PhotoDetails.aspx?ID={0}") %>'>
                        <asp:Image src='<%# Eval("Picture") %>' Height = '250px' Width = '250px' ID="Image1" runat="server"/>  
                    </asp:HyperLink><h4>This picture is rated by most Users as:</h4><ajx:Rating ID="AvgRate" runat="server" 
                CurrentRating='<%# Eval("AvgRate") %>' BorderWidth="1" BorderStyle="Solid"
    width="200" Height="40" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" EmptyStarCssClass="emptyRatingStar" filledStarCssClass="filledRatingStar" ReadOnly="True"></ajx:Rating></ItemTemplate></asp:DataList><asp:SqlDataSource 
            ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
            
            SelectCommand="SELECT TOP 1 [ID], [PhotoName], [Picture], [AvgRate] FROM [AvgRateRecord]"></asp:SqlDataSource></p></div>

<div        
        
        
        
        
        
        
        
        style="position: relative; top: -783px; left: 635px; width:251px;border:2px solid #969696;"><h3>The Most Liked Picture</h3><p><asp:DataList 
            ID="DataList4" runat="server" DataSourceID="SqlDataSource4"><ItemTemplate><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID","PhotoDetails.aspx?ID={0}") %>'>
                        <asp:Image src='<%# Eval("Picture") %>' Height = '250px' Width = '250px' ID="Image1" runat="server"/>  
                    </asp:HyperLink><h4><asp:Label ID="Label1" runat="server" 
                    Text='<%# Eval("ReaderCount") %>'></asp:Label>&nbsp;People liked this Picture</h4></ItemTemplate></asp:DataList><asp:SqlDataSource 
            ID="SqlDataSource4" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
            
            SelectCommand="SELECT TOP 1 [ReaderCount], [ID], [Picture] FROM [UserLikesCount]"></asp:SqlDataSource></p></div></asp:Content>